package com.lagou.edu.controller;

import com.lagou.edu.service.code.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;

    @PostMapping("/create/{email}")
    public boolean create(@PathVariable("email") String email){
        return codeService.create(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public int validate(@PathVariable("email") String email, @PathVariable("code") String code){
        return codeService.validate(email,code);
    }

}
